<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>查询历史</title>
    <script th:src="@{/layui/layui.js}" type="text/javascript"></script>
    <link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
</head>
<body>

<div class="layui-panel" style="padding: 8px;">
    <fieldset class="layui-elem-field layui-border-blue">
        <legend>搜索信息</legend>
        <form class="layui-form layui-form-pane" style="margin: 20px;">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">用户ID</label>
                    <div class="layui-input-inline">
                        <input class="layui-input" type="text" name="mid" autocomplete="off" />
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">类目名</label>
                    <div class="layui-input-inline">
                        <input class="layui-input" type="text" name="categoryName" autocomplete="off" />
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <a class="layui-btn layui-btn-primary" lay-submit="" lay-filter="searchBtn">
                            <i class="layui-icon layui-icon-search"></i>
                            搜索
                        </a>
                    </div>
                </div>
            </div>
        </form>
    </fieldset>
    <div>
        <table id="searchTable" lay-filter="searchTable"></table>
    </div>
</div>


<script>
    var $,active;
    layui.use(['table','form','jquery','layer'],function(){
        var table = layui.table,layer = layui.layer,form = layui.form;
        $ = layui.jquery

        //加载表格
        table.render({
            elem:'#searchTable',
            height:'full-160',
            page:true,
            url:'/system/search/find',
            cols:[
                [
                    {field:'id',title: '搜索历史ID',width:200,templet:'#photo',align: 'center'},
                    {field:'mid',title:'用户ID',width:200,align: 'center'},
                    {field:'categoryName',title:'类目名',width:200,align: 'center'},
                    {field:'createTime',title:'创建时间',width:400,align: 'center'}
                ]
            ]
        })

        //监听搜索按钮
        form.on('submit(searchBtn)',function(data){
            var dataForm = data.field;
            table.reload('searchTable',{
                where:{
                    mid:dataForm.mid
                }
            })
        })

    });
</script>
</body>
</html>
